<?php echo $this->load->view('meta'); ?>
<title>xa-ncsu | blog</title>
<?php echo $this->load->view('header'); ?>
<p><?=anchor('blog', 'back to blog');?><?php if ($con_user->userid == $post->authorid) { echo ' | '.anchor('blog/editPost/'.$post->id,'edit this post'); }?></p>
<div class="entry">
	<div class="entry-title">
		<h2><?=$post->title?></h2>
		<p class="author"><?=$post->author?></p>
		<p class="posted"><?=$post->posted?></p>
	</div>
	<div class="entry-body"><?=$post->body?></div>

<?php if ($comments->num_rows() > 0) : ?>	
	<p>Responses:</p>
	<?php foreach ($comments->result() as $comment) : ?>
		<div class="comment">
			<span class="right"><?=$comment->edit?></span>
			<span><?=$comment->authorname?> - <?=$comment->posted?></span>
			<p><?=$comment->body?></p>
			<?php if($comment->edited != NULL):?><br /><p class="edited">edited by <?=$comment->editor?> on <?=$comment->edited?></p><?php endif; ?>
		</div>
	<?php endforeach; ?>
<?php else: ?>
	<p><strong>No Responses</strong></p>
<?php endif; ?>
</div>


<?=form_open('blog/createComment');?>
<fieldset>
	<legend>post a comment</legend>
	<ol class="fivehundred">
		<li><label for="name">name</label>
			<input type="input" name="authorname" /></li>
		<li><label for="body">comment</label>
			<textarea name="body" rows="10"></textarea></li>
		<li><?=form_hidden('postid', $this->uri->segment(3));?>
			<?=form_submit('','submit');?></li>
	</ol>
</fieldset>
</form>
<?php echo $this->load->view('footer'); ?>